package dst.benchmark;

import dst.search_tree.avl.AvlTree;

/**
 *
 * Fully Tested: No
 * Fully Documented: No
 * Created: 22-Mar-2012
 * Last Updated: 22-Mar-2012
 *
 * @author Shimu Wu
 */
public class AvlTreeBenchMark {

    private static class AvlTreeBenchMarker implements BenchMarkable {

        private int totalElements;

        private AvlTreeBenchMarker(int totalElements) {
            this.totalElements = totalElements;
        }

        public void execute() {
            AvlTree<Integer> tree = new AvlTree<Integer>(0);

            for (int i = 0; i < totalElements; i++) {
                tree.add(i);
            }
            
            tree = null;
        }

        public String getDescription() {
            return "Inserting " + totalElements + " elements into Avl Tree";
        }
    }

    public static void main(String[] args) {
        int totalElements = 500000;
        int iteration = 100;
        
        AvlTreeBenchMarker b1 = new AvlTreeBenchMarker(totalElements);
        BenchMarker benchMarker = new BenchMarker();
        
        benchMarker.benchMark(b1, iteration);

        /*
        AvlTree<Integer> tree = new AvlTree<Integer>(0);

        for (int i = 0; i < totalElements; i++) {
            tree.add(i);
        }

        tree.printInOrder(); */
    }
}
